const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const registerAIQuery = require('./ai-service/index.js');
const app = express();
const port = 3000;

// 使用 body-parser 中间件解析 JSON 请求体
app.use(bodyParser.json());
app.use(express.static(path.join(__dirname, 'public')));

registerAIQuery(app, '/api');

// 启动服务器
app.listen(port, () => {
    console.log(`服务器运行在端口 ${port}`);
    console.log(`POST API 地址: http://localhost:${port}/api/queryAI`);
    console.log(`页面地址: http://localhost:${port}/`);
});    